package com.esun.cheetah.biz.recharg;

import java.util.HashMap;

import org.json.JSONException;
import org.json.JSONObject;

import android.os.Handler;

import com.esun.cheetah.biz.personal.personalinfo.UserInfo;
import com.esun.cheetah.config.BizCode;
import com.esun.cheetah.config.Key;
import com.esun.cheetah.network.AbsInferiorityCommunicater;
import com.esun.util.log.EDebug;

/**
 * 
 * @Package com.esun.cheetah.biz.recharg.SzxRechargCommunicater
 * @ClassName: SzxRechargCommunicater
 * @Description: 充值卡充值通讯类
 * @author 孔祥攀 <br/>
 * @date 2012-4-12 上午9:29:09
 * 
 */
public class SzxRechargCommunicater extends AbsInferiorityCommunicater {

	private String status;// 状态
	private String msg;// 返回信息
//	private String username;
//	private String password;
	private String money;
//	private String channel;
//	private String nextfrom;
	private String cardId;
	private String cardPassword;
	private String cardType;

	public SzxRechargCommunicater(Handler handler, String money, String cardId,
			String cardPassword, String cardType) {
		super(handler);
		this.money = money;
		this.cardId = cardId;
		this.cardPassword = cardPassword;
		this.cardType = cardType;
	}

	@Override
	public HashMap<String, String> comHashMap() {
		HashMap<String, String> hmJson = new HashMap<String, String>();
		hmJson.put(Key.KEY_ID, BizCode.BIZCODE_RECHARGE_HF);
		hmJson.put(Key.KEY_USERNAME, UserInfo.getUserInfo().getUserName());
		hmJson.put(Key.KEY_PASSWORD, UserInfo.getUserInfo().getUserpwdMD5());
		hmJson.put(Key.KEY_MONEY, money);
		hmJson.put("channel", "2169");
		hmJson.put("nextfrom", "Clientlive");
		hmJson.put(Key.KEY_CARDID, cardId);
		hmJson.put(Key.KEY_CARDPASSWORD, cardPassword);
		hmJson.put(Key.KEY_CARDTYPE, cardType);
		return hmJson;
	}

	@Override
	public void getJsonContent(String serverRes) throws JSONException {

		JSONObject json = new JSONObject(serverRes);
		status = json.getString(Key.KEY_STATUS);
		msg = json.getString(Key.KEY_MSG);

		EDebug.o("msg---" + msg);
		EDebug.o("status---" + status);

	}

	public String getStatus() {
		return this.status;
	}

	public String getMsg() {
		return this.msg;
	}

}
